package node;

import lexer.LexType;
import parser.Parser;

import java.io.IOException;

public class FuncTypeNode extends ASTNode {
    public final String name = "<FuncType>";
    // FuncType → 'void' | 'int' | 'char'
    private final String type;

    public FuncTypeNode(String type) {
        this.type = type;
    }

    @Override
    public void show() throws IOException {
        if (type.equals("int")) {
            Parser.parserWriter.write(LexType.INTTK + " " + "int" + "\n");
        } else if (type.equals("char")) {
            Parser.parserWriter.write(LexType.CHARTK + " " + "char" + "\n");
        } else if (type.equals("void")) {
            Parser.parserWriter.write(LexType.VOIDTK + " " + "void" + "\n");
        }
        Parser.parserWriter.write(name + "\n");
    }

    public String getType() {
        return type;
    }

}
